﻿using Shinva.LADModel.Abstractions;
using Shinva.Variables.Interface;
using Shinva.Variables.Models;
using Shinva.Variables.Type.bit;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Shinva.LADModel.Type.ConversionOperations
{
    public class ConvertC:ElementNodeBase
    {
        public IPlcMember IN { get; set; }
        public IPlcMember OUT { get; set; }
        public override PlcBool EN
        {
            get
            {
                return en;
            }
            set
            {
                en = value;
            }
        }
        public override PlcBool ENO
        {
            get
            {

                eno.Value = en.Value ;
                return eno;
            }
            set
            {
                eno = value;
            }
        }

        public ConvertC()
        {
            Name= "Convert";
            variableTableInterface.AddVariable("in", StorageType.Input);
            variableTableInterface.AddVariable("out", StorageType.Output);
            IN = variableTableInterface.GetVariableValue<IPlcMember>("in");
            OUT = variableTableInterface.GetVariableValue<IPlcMember>("out");
        }
        public override IPlcMember GetInterfaceVariableByName(string name)
        {
            if(name=="in") return IN;
            else if(name=="out") return OUT;
            else return variableTableInterface.GetVariableValue<IPlcMember>(name);
        }
    }
}
